Skip to content

Fix custom theme colors not applying due to outdated CSS selectors an…#3799

Open
Ganeshbhargav wants to merge 1 commit into
code-charity:masterfrom
Ganeshbhargav:master
Open

Fix custom theme colors not applying due to outdated CSS selectors an…#3799
Ganeshbhargav wants to merge 1 commit into
code-charity:masterfrom
Ganeshbhargav:master

Conversation

@Ganeshbhargav

Copy link
Copy Markdown

Issue

Custom theme colors (primary/text) were not applying and remained black/white.

Cause

YouTube updated its internal CSS variables and DOM behavior.
The extension relied on the selector:
html[it-theme=custom]

However, this attribute is not consistently present, causing styles to never apply.

Fix

  • Replaced selector with :root for global application
  • Ensured style injection works regardless of attribute presence
  • Added fallback and re-injection logic to handle YouTube dynamic updates
  • Fixed masthead selector to remove dependency on custom attribute

Result

  • Custom theme colors now apply correctly
  • Works with latest YouTube UI
  • Stable even during SPA navigation

Tested on

  • Chrome
  • Latest YouTube version

@rajanarahul93

Copy link
Copy Markdown
Contributor

@Ganeshbhargav thanks for the pr!!
Can you please attach screenshots or a screen recording

@ZaCloud

ZaCloud commented May 6, 2026

Copy link
Copy Markdown
black mode not blacking

Black mode is only affecting the top bar, not the main video page, which is near-black but still not quite true black (looks the same as YouTube Dark). This is after both checking for updates & refreshing. Oh, and it darkens the uploader's channel name to a light gray instead of white.

EDITED TO ADD:
OS: Windows 10 desktop.
Browser: Chrome Version 147.0.7727.138 (Official Build) (64-bit)

@rajanarahul93 rajanarahul93 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@ImprovedTube2

Copy link
Copy Markdown
Collaborator

thank you! @Ganeshbhargav
Sorry for the delay!! The neccessary update was done with css: d8af92c

We could shorten/combine the static theme's css a lot and inject everything conditionally except for the background (and font) which can be as fast as possible & with redundancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants